package com.flower.hooc.service.impl;

import com.flower.hooc.bean.pojo.entity.Video;
import com.flower.hooc.mapper.VideoMapper;
import com.flower.hooc.service.VideoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author hyorin
 * @date:2020.9.1
 */
@Service
public class VideoServiceImpl implements VideoService {

    private Logger logger = LoggerFactory.getLogger(VideoServiceImpl.class);

    @Autowired
    private VideoMapper videoMapper;

    @Override
    public Video selectVideoById(Long videoId) {

        Video video = videoMapper.selectVideoById(videoId);
        if (video == null) {
            logger.warn("getById user not exist [userId:{}]", videoId);
            throw new RuntimeException("视频不存在");
        }
        return video;
    }
}
